package com.ycy.temperature.view.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.qmuiteam.qmui.util.QMUIStatusBarHelper;
import com.ycy.temperature.R;
import com.ycy.temperature.date.utils.SharedPreferencesUtils;
import com.ycy.temperature.view.base.BaseActivity;
import com.ycy.temperature.view.view.TitleView;
import com.zhy.autolayout.AutoLinearLayout;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by MI on 2018/7/17.
 */

public class SetUpActivity extends BaseActivity {

    @BindView(R.id.title)
    TitleView title;
    @BindView(R.id.textView)
    TextView textView;
    @BindView(R.id.Layout_Function)
    AutoLinearLayout LayoutFunction;
    @BindView(R.id.Layout_Other)
    AutoLinearLayout LayoutOther;

    @BindView(R.id.Image_Icon)
    ImageView ImageIcon;

    boolean Open = true;

    @Override
    protected int getLayout() {
        return R.layout.activity_setup;
    }

    @Override
    protected void setData() {

    }

    @Override
    protected void init(Bundle inBundle) {
        ButterKnife.bind(this);
        QMUIStatusBarHelper.setStatusBarLightMode(this);
        title.getLeft_ibtn().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

    @OnClick({R.id.Layout_Function, R.id.Text_Quit})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.Layout_Function:
                if (Open) {
                    Open = false;
                    LayoutOther.setVisibility(View.VISIBLE);
                    ImageIcon.setImageResource(R.mipmap.image_botton);
                } else {
                    Open = true;
                    LayoutOther.setVisibility(View.GONE);
                    ImageIcon.setImageResource(R.mipmap.image_right);
                }
                break;
            case R.id.Text_Quit:
                SharedPreferencesUtils.putBoolean("login", "boolean", false);
                SharedPreferencesUtils.putString("token", "String", "");
                startActivity(new Intent(SetUpActivity.this, LoginActivity.class));
                break;
        }
    }
}
